package com.hmall.search.web;


import com.hmall.common.dto.PageDTO;
import com.hmall.search.pojo.ItemDoc;
import com.hmall.search.pojo.Page;
import com.hmall.search.service.ISearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;


@RestController
@RequestMapping("/search")
public class SearchController{
    @Autowired
    private ISearchService searchService;
   @GetMapping("/index")
    public void Index(){
       searchService.index();
   }
   @GetMapping("/dev")
    public void dev(){
       searchService.dev();
   }
   @PostMapping("/filters")
    public Map<String, List<String>> filters(@RequestBody Page page){
       return searchService.filters(page);
   }

    /**
     * 搜索查询
     * @param page
     * @return
     */
   @PostMapping("/list")
    public PageDTO<ItemDoc> list(@RequestBody Page page){
       return searchService.list(page);
   }

}
